package cn.ekgc.system.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@Slf4j
public class UserConfig {

    public UserConfig(){
        log.info("调用");
    }

    // 作为对象放在spring中
    @Bean
    @ConditionalOnMissingClass("cn.ekgc.system.config.User")
    //@Conditional(Usercondition.class)
    public User user1(){
        log.info("调用User1");

        // 只有当项目中出现了objectMapper类对象的时候才加载user对象
        return new User();
    }

    @Bean
    public User user2(){
        log.info("调用user2");

        // 只有当项目中出现了objectMapper类对象的时候才加载user对象
        return new User();
    }

}
